package com.dk.bean;



import com.dk.em.ResultEnum;

import java.io.Serializable;

public class Result<T> implements Serializable {

    private Integer code; // 返回状态码 ：  10000 操作成功 ，10001 操作失败 ，10002 没有权限 ，10003 未登录
    private String massage;// 返回状态信息 成功 失败 权限 未登录
    private T data; //返回的数据


    public static Result buildResult(ResultEnum e){
        Result result = new Result(e.getCode(), e.getMessage());
        return result;
    }

    public Result(Integer code, String massage) {
        this.code = code;
        this.massage = massage;
    }

    public Result() {
    }

    public Result(Integer code, String massage, T data) {
        this.code = code;
        this.massage = massage;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMassage() {
        return massage;
    }

    public void setMassage(String massage) {
        this.massage = massage;
    }

    public T getData() {
        return data;
    }

    public Result setData(T data) {
        this.data = data;
        return this;
    }
}
